package com.fbli.test;


import cn.hutool.core.date.DateUtil;
import com.fbli.test.entity.Project;
import com.fbli.test.mapper.TaskMapper;
import com.fbli.test.util.IdUtil;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.*;

@SpringBootTest
public class StreamController {
    @Autowired
    IdUtil idUtil;
    @Autowired
    TaskMapper taskMapper;
    @Test
    void testIdUtil(){
        idUtil.createTaskId();
    }
    @Test
    void testDateTiem(){
        /*Date date=new java.util.Date();
        java.sql.Date sdate=new java.sql.Date(date.getTime());
        System.out.println(sdate.getTime());*/
    }
    @Test
    void testTask(){
        /*List<Project> list = taskMapper.selectTask(3, 1);
        for (Project project:list){
            System.out.println(project.toString());
        }*/
        /*List<Project> list = taskMapper.selectTaskShow(3, 1);
        for (Project project:list){
            System.out.println(project.toString());
        }*/

    }

    public static void main(String[] args) {
       /* //生成唯一id
        String id= UUID.randomUUID().toString();
        //替换uuid中的"-"
        id=id.replace("-", "");
        System.out.println(id+"--"+id.length());
        int getNum=100;
        long getTime=System.currentTimeMillis();
        long celTime = getTime - getNum * 1000;
        for (int i = 0; i < getNum; i++) {
            String timeStr = DateUtil.formatTime(new Date(celTime));
            System.out.println(timeStr);
            celTime += 1000;
        }*/
        String url ="zs/ls/wa";
        int i = url.lastIndexOf("/");
        String temp = url.substring(i+1);
        System.out.println(temp);
    }
    @Test
    void listTest(){
        List<String> list = new ArrayList<>();
        list.add("1");
        list.add("2");
        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            String item = iterator.next();
            if ("2".equals(item)) {
                iterator.remove();
            }
        }
        /*for (String item : list) {
            if ("1".equals(item)) {
                list.remove(item);
            }
        }*/
    }
    }

